import React from 'react'
import { NavLink } from 'react-router-dom'
import { Outlet } from 'react-router-dom'


export default function Main() {
  //
  return (
    <div>
      <div>
        <div className="row">
          <div className="col-xs-offset-2 col-xs-8">
            <div className="page-header"><h2>React Router Demo</h2></div>
          </div>
        </div>
        <div className="row">
          <div className="col-xs-2 col-xs-offset-2">
            <div className="list-group">

              {/* NavLink的to属性指向路由地址,这个路由地址在App中已经设置过使用子组件,子组件使用的位置是Outlet */}
              <NavLink className="list-group-item " to={'/main/About'}>About</NavLink>
              <NavLink className="list-group-item " to={'/main/Home'}>Home</NavLink>
            </div>
          </div>
          <div className="col-xs-6">
            <div className="panel">
              <div className="panel-body">
                {/* 这个位置渲染二级路由 */}
                <Outlet />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  )
}
